import 'package:flutter/foundation.dart';

class HomePageBannerEntity {
  int tag;
  String message;
  BannerResultEntity resultEntity;

  HomePageBannerEntity({this.tag, this.message, this.resultEntity});

  factory HomePageBannerEntity.fromJson(Map<String, dynamic> json) {
    return HomePageBannerEntity(
      tag: json['Tag'],
      message: json['Message'],
      resultEntity: json['Result'] != null
          ? BannerResultEntity.fromJson(json['Result'])
          : null,
    );
  }

  Map<String, dynamic> toJson() {
    return {
      'Tag': tag,
      'Message': message,
      'Result': resultEntity,
    };
  }
}

class BannerResultEntity {
  List<BannerEntity> dataList;

  BannerResultEntity({this.dataList});

  factory BannerResultEntity.fromJson(Map<String, dynamic> json) {
    return BannerResultEntity(
      dataList: json['DataList'] == null
          ? null
          : List<BannerEntity>.from(
              json['DataList'].map((x) => BannerEntity.fromJson(x))),
    );
  }

  Map<String, dynamic> toJson() {
    return {
      'DataList': List<dynamic>.from(dataList.map((e) => e.toJson())),
    };
  }
}

class BannerEntity {
  String imagePath;

  BannerEntity({@required this.imagePath});

  factory BannerEntity.fromJson(Map<String, dynamic> json) {
    return BannerEntity(imagePath: json['ImagePath']);
  }

  Map<String, dynamic> toJson() {
    return {
      'ImagePath': imagePath,
    };
  }
}
